package com.pinyoumei.app.view.dialog;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.util.DisplayMetrics;
import android.view.Gravity;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.ImageView;

import com.pinyoumei.app.R;

/**
 * 温馨提示的Dialog
 */
public class LoanDetailDialog extends Dialog  {
    private Context context;
    private int layoutResID;      // 布局文件id
    private Button button;
    private ImageView image_cancle;
    public LoanDetailDialog(Context context){
        super(context);
        this.context = context;
    }

    public LoanDetailDialog(Context context, boolean cancelable, OnCancelListener cancelListener){
        super(context,cancelable,cancelListener);
    }
    public LoanDetailDialog(Context context, int layoutResID){
        super(context, R.style.dialogStyle); //dialog的样式
        this.context = context;
        this.layoutResID = layoutResID;

    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Window dialogWindow = getWindow();
        dialogWindow.setGravity(Gravity.CENTER);//内部区域显示在中间
        //dialogWindow.setWindowAnimations(R.style.bottom_menu_animation);
        WindowManager.LayoutParams  lp = dialogWindow.getAttributes();
        DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics();//获取屏幕宽高
        lp.width = (int)(displayMetrics.widthPixels * 0.9);//宽度设置为屏幕宽度的80%
        dialogWindow.setAttributes(lp);
        setCanceledOnTouchOutside(true);//点击Dialog外部消失
        setContentView(layoutResID);


    }

}
